package com.chy.order_meal.controller;


import com.chy.order_meal.bean.ChyResponse;
import com.chy.order_meal.po.Type;
import com.chy.order_meal.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/type/")
public class TypeController {

    @Autowired
    public TypeService service;

    @GetMapping("/get/all")
    @ResponseBody
    public ChyResponse getAll(){

        try{
            List<Type> data = service.getAll();
            return ChyResponse.simpSuccess(data);
        }catch (Exception e){
            e.printStackTrace();
            return new ChyResponse(false,"类型查询失败",null);
        }
    }



}
